
#ifndef CONSTRAINTSOLVER_H_
#define CONSTRAINTSOLVER_H_

#include "Core.h"
#include "Constraint.h"

namespace p2 {

class World;
class ConstraintSolver
{
public:
	inline ConstraintSolver(World* owner);
	virtual ~ConstraintSolver();

	void preStep(real64 dT, Constraint::Set& constraints);
	bool solvePositions(real64 dT, Constraint::Set& constraints, uint32 numIterations);
	bool solveVelocities(real64 dT, Constraint::Set& constraints, uint32 numIterations);

protected:
	inline ConstraintSolver(void* userData);

private:
	World* _owner;
	void* _userData;
};

inline ConstraintSolver::ConstraintSolver(World* owner)
:	_owner(owner),
 	_userData(NULL)
{
}

}

#endif	//CONSTRAINTSOLVER_H_
